import javax.swing.*;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;

public class test3 {
    private JPanel jp;
    private JButton myfavoritesbtn;
   // private JButton playlistbtn;
    private JButton changebtn;
    private String username;
    JFrame jf = new JFrame("音乐播放器 - 我的界面");

    public test3(String username) {

        this.username = username;
        setupUI();

    }
    // 可以添加一个方法来启动 test4
//    public void startTest4() {
//        test4 t4 = new test4(this.username); // 使用从 test1 传递来的用户名实例化 test4
//        jf.setVisible(false); // 隐藏 test3 窗口
//    }
    public void startTest6() {
        test6 t6 = new test6(this.username); // 使用从 test1 传递来的用户名实例化 test4
        jf.setVisible(false); // 隐藏 test3 窗口
    }
    private void setupUI() {
        // UI组件的初始化和布局设置...
        jf.setSize(500, 500);
        jf.setLocationRelativeTo(null);
        jf.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
        initComponents();
        myfavoritesbtn.addMouseListener(new MouseAdapter() {
            @Override
            public void mouseClicked(MouseEvent e) {
                startTest6();
                jf.setVisible(false);
            }
        });
//        playlistbtn.addMouseListener(new MouseAdapter() {
//            @Override
//            public void mouseClicked(MouseEvent e) {
//                startTest4();
//            }
//        });
        changebtn.addMouseListener(new MouseAdapter() {
            @Override
            public void mouseClicked(MouseEvent e) {
                test1 t1 = new test1();
                jf.setVisible(false);
            }
        });


        jf.add(jp);
        jf.setVisible(true);
    }

    private void initComponents() {
        jp = new JPanel();
        myfavoritesbtn = new JButton("我的收藏");
       // playlistbtn = new JButton("我的歌单");
        changebtn = new JButton("切换账号");
        jp.setLayout(null); // 设置面板布局为网格布局3
        myfavoritesbtn.setBounds(0,0,500,30);
        //playlistbtn.setBounds(0, 30, 500, 30);
        changebtn.setBounds(0,420,500,30);
        jp.add( myfavoritesbtn);
       // jp.add(playlistbtn);
        jp.add(changebtn);
    }


//    public static void main(String[] args) {
//        new test3("6");
//    }
}
